Skip to content

Add PreloadManager snippets, and update media3 to 1.8.0 #574

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

asolovay
Copy link
Contributor

Submitting doc snippets used for the new PreloadManager documentation. Had to bump the Media3 version up to 1.8.0 for some of the new APIs in that doc.

Once we've submitted this in Github, I'll update my docs to pull the code snippets in from there.

asolovay added 8 commits July 30, 2025 15:44
Adding snippets to support new PreloadManager docs. That requires bumping the Media3
version up to 1.8.0.
Adding snippets to support new PreloadManager docs. That requires bumping the Media3
version up to 1.8.0.
Adding snippets to support new PreloadManager docs. That requires bumping the Media3
version up to 1.8.0.
Adding snippets to support new PreloadManager docs. That requires bumping the Media3
version up to 1.8.0.
Adding snippets to support new PreloadManager docs. That requires bumping the Media3
version up to 1.8.0.
Adding snippets to support new PreloadManager docs. That requires bumping the Media3
version up to 1.8.0.
Adding snippets to support new PreloadManager docs. That requires bumping the Media3
version up to 1.8.0.
Copy link

snippet-bot bot commented Jul 31, 2025

Here is the summary of changes.

You are about to add 7 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

asolovay and others added 3 commits July 31, 2025 15:02
Adding snippets to support new PreloadManager docs. That requires bumping the Media3
version up to 1.8.0.
@asolovay asolovay self-assigned this Jul 31, 2025
@@ -187,6 +189,8 @@ play-services-wearable = { module = "com.google.android.gms:play-services-wearab
validator-push = { module = "com.google.android.wearable.watchface.validator:validator-push", version.ref = "validatorPush" }
wear-compose-material = { module = "androidx.wear.compose:compose-material", version.ref = "wearComposeMaterial" }
wear-compose-material3 = { module = "androidx.wear.compose:compose-material3", version.ref = "wearComposeMaterial3" }
androidx-media3-common-ktx = { group = "androidx.media3", name = "media3-common-ktx", version.ref = "media3CommonKtx" }
media3-exoplayer = { group = "androidx.media3", name = "media3-exoplayer", version.ref = "media3Exoplayer" }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we keep naming convention as same ? Eg change to "androidx-media3-exoplayer"

Copy link

@MayuriKhinvasara MayuriKhinvasara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added one minor comment. LGTM otherwise

// [START android_defaultpreloadmanager_getAndPlayMedia]
// When a media item is about to display on the screen
val mediaSource = preloadManager.getMediaSource(mediaItem)
if (mediaSource != null) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we change the L101-103 to

if (mediaSource != null) {
    player.setMediaSource(mediaSource)
} else {
    // If the mediaItem hasn't been added to the preload manager yet,
    // set it directly to the player when it's about to play
    player.setMediaItem(mediaItem)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants